#include "LoadingLayer.h"
#include "PlayScene.h"

LoadingLayer::LoadingLayer() : IDialog()
{
    RegDialogCtrl("Button_Logon", btnLogon);
    RegDialogCtrl("Image_Bg", imgBg);
    RegDialogCtrl("txt_version", txt_version);
}

LoadingLayer::~LoadingLayer(){
}

void LoadingLayer::onUILoaded() {
    btnLogon->addClickEventListener([this](Ref* sender) {
        DialogManager::shared()->closeAllDialog();
        Director::getInstance()->replaceScene(PlayScene::create());
    });
    Size visibleSize = Director::getInstance()->getVisibleSize();
    txt_version->setPosition(Vec2(20.0f, 20.0f));
    imgBg->setPosition(visibleSize.width * 0.5f, visibleSize.height * 0.5f);
    imgBg->setScale(MAX(visibleSize.width / 1200, visibleSize.height / 675));
    txt_version->setString("v 1.7.0");
}

